#include "dominion.h"
#include "dominion_helpers.h"
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>
#include "rngs.h"

#define NOISY_TEST 1

void checkCouncil_room_card() {
    printf ("RANDOM TESTING council room.\n");
    int k[10] = {adventurer, council_room, feast, gardens, mine,
	    remodel, smithy, village, baron, great_hall};
    struct gameState post;
    int numTests = 100;
    int testCount = 0;
    int i;
    int player;
    srand(time(NULL));
    while (testCount < numTests) {
        initializeGame(4, k, 1, &post);
        for (i = 0; i < 4; i++) {
            post.handCount[i] = 5;
        }
        player = rand() % 4;
        council_room_card(player, &post, 0);
        printf("Expected numBuys: 2, Actual: %d\n", post.numBuys);
        assert(post.numBuys == 2);
        printf("Expected handCount for current player: 9, actual %d\n",
            post.handCount[player]);
        assert(post.handCount[player] == 9);
        for (i = 0; i < 4; i++) {
            if (i != player) {
                printf("Expected handCount for player %d: 6, actual %d\n",
                    i, post.handCount[i]);
                assert(post.handCount[i] = 6);
            }
        }
        testCount++;
    }
}


int main () {
  checkCouncil_room_card();
  printf ("ALL TESTS OK\n");
  return 0;
}
